wowwikifandomcom-20200223-history
API COMBAT LOG EVENT
COMBAT_LOG_EVENT_UNFILTERED redirects to this page, but most add-on developers will want to use it in preference to COMBAT_LOG_EVENT, because the events provided by the latter will only reflect the user's actual combat log. :Note: COMBAT_LOG_EVENT and COMBAT_LOG_EVENT_UNFILTERED have identical parameters. All information provided here applies to both events. Base Parameters The timestamp parameter has almost the same format as the return value of the time() function. You can use it as the second parameter to date(). The only difference is that time() returns an integer (the unit is seconds), while the timestamp parameter has three decimal places (milliseconds). That means (timestamp-floor(timestamp))*1000 is the number of milliseconds of the timestamp. More information on GUIDs (including format, how to tell a player from an NPC, pets, mob IDs, and more) can be found on the API UnitGUID page. Events How to get full event strings: Read prefix to suffix in order and use the parameter table as specified. Unused entries are nil. A Blank cell means that there are no additional arguments for this pre- or suffix. Prefixes The Parameters listed with prefixes are numbered in the order they come after the base 8 parameters. Suffixes The Parameters listed with suffixes are numbered in the order they come after the prefix parameters. Special Events Parameter Values Spell School Power Type Miss type *"ABSORB" *"BLOCK" *"DEFLECT" *"DODGE" *"EVADE" *"IMMUNE" *"MISS" *"PARRY" *"REFLECT" *"RESIST" Aura Type *"BUFF" *"DEBUFF" Environmental Type *"DROWNING" *"FALLING" *"FATIGUE" *"FIRE" *"LAVA" *"SLIME" *More possible but currently unconfirmed Failed Type *"A more powerful spell is already active" *"Another action is in progress" *"Can only use outside" *"Can only use while swimming" *"Can't do that while asleep" *"Can't do that while charmed" *"Can't do that while confused" *"Can't do that while fleeing" *"Can't do that while horrified" *"Can't do that while incapacitated" *"Can't do that while moving" *"Can't do that while silenced" *"Can't do that while stunned" *"Interrupted" *"Invalid target" *"Item is not ready yet" *"Must be in Bear Form, Dire Bear Form" *"Must have a Ranged Weapon equipped" *"No path available" *"No target" *"Not enough energy" *"Not enough mana" *"Not enough rage" *"Not yet recovered" *"Nothing to dispel" *"Out of range" *"Target is friendly" *"Target is hostile" *"Target needs to be in front of you." *"Target not in line of sight" *"Target too close" *"You are dead" *"You are in combat" *"You are in shapeshift form" *"You are unable to move" *"You can't do that yet" *"You must be behind your target." *"Your target is dead" *More possible but currently unconfirmed Examples Introduction I wanted to post some info about what I have learned about using this event. I think the description of how the work arguments is confusing. Hopefully this provides some clarity. There are always at least 8 arguments. (arg1 through arg8) Depending on the Prefix there will be 0, 1, or 3 more arguments. These will be numbered starting with 9 and going up to 11 if necessary. Depending on the Suffex there will be 0-8 more arguments. These will be numbered starting from the last Prefix argument (IE 9, 10, or 12). Sample Arguments Example Example: The following 2 examples show the parameters used for a SPELL_MISS event and a SWING_DAMAGE events Simple Function Example Example the following function would display a message whenever a Mind Blast crits. Foo.xml Foo_OnLoad(); Foo_OnEvent(self, event, ...); -- The ... parameter passes all arguments that would otherwise be implicitly sent prior to 3.0. -- As of 3.0, you will need to explicitly send these arguments (as done here). Foo.lua Function Foo_OnLoad() this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); end Function Foo_OnEvent(self, event, ...) local timestamp, type, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...) -- Note, for this example, you could just use 'local type = select(2, ...)'. The others are included so that it's clear what's available. if (event "COMBAT_LOG_EVENT_UNFILTERED") then if (type "SPELL_DAMAGE") then local spellId, spellName, spellSchool = select(9, ...) -- Use the following line in game version 3.0 or higher, for previous versions use the line after local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(12, ...) if (spellName "Mind Blast" and critical true) then -- true for clarity only. Not needed. DEFAULT_CHAT_FRAME:AddMessage("Mind Blast Just Critted!"); end end end end Event Descriptions Summary Of what I have learned about when events fire and when they don't: (Preliminary) Prefixes Suffixes Special Events Category:API events